package com.java.exer_3;

/**
 * @author shkstart
 * @create 2021-01-12 14:45
 */
public class PokerTest {
    public static void main(String[] args) {

        Poker[] poker = new Poker[52];
        //循环
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j < 14; j++) {
                int index = i * 13 + j - 1;
                poker[index] = new Poker(i, j);
                System.out.print(poker[index] + " ");

            }
            System.out.println();
        }
        System.out.println("----------------------------------");
        //洗牌
        for (int i = 0; i < 36; i++) {
            int begin = (int) (Math.random() * 52);
            int end = (int) (Math.random() * 52);
//            System.out.println(begin);
//            System.out.println(end);
            reserve(poker, begin, end);
        }

        for (int i = 0; i < 52; i++) {

            if (i % 13 == 0) {
                System.out.println();
            }
            System.out.print(poker[i] + " ");
        }

    }

    public static void reserve(Poker[] poker, int begin, int end) {
        Poker t = poker[begin];
        poker[begin] = poker[end];
        poker[end] = t;

    }


}
